﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._02_FactoryMethod
{
    /// <summary>
    /// 抽象工厂
    /// </summary>
    public abstract class PaymentFactory
    {
        public abstract IPayment CreatePayment();
        /// <summary>
        /// 处理支付
        /// </summary>
        /// <param name="amount"></param>
        public void ProcessPayment(decimal amount)
        {
            var payment = CreatePayment();
            payment.Pay(amount);
        }
    } 

}
